< previous page page_150 next page >

Page 150
0150-01.jpg
Figure 5.17.
Laying out the
vtxCheckSize controls.
After laying out the controls, add the code in Listing 5.37 to the CheckSizeError event of the vtxCheckSize control.
Type.gifListing 5.37. Coding the error message for vtxCheckSize.
Private Sub vtxCheckSize_CheckSizeError(vValue As Variant)
    '
    MsgBox "Invalid Entry Length! [" & CStr(vValue) & "]"
    '
End Sub
You should also add code to the cmdOK_Click event to handle validation if the user never loses focus on the vtxCheckSize control. See Listing 5.38 for modifications to the code.
Type.gifListing 5.38. Modifying the cmdOK_Click event code.
Private Sub cmdOK_Click()
    '
    If vtxInRange.CheckRange = True Then
        vtxInRange.InRangeValidate
    End If
    '
    If vtxCheckSize.CheckSize = True Then
        vtxCheckSize.CheckSizeValidate
    End If
    '
End Sub
Now save and run the TEST project. You see an error message when you enter a value in the vtxCheckSize field that is less than three characters or more than ten characters long.

 
< previous page page_150 next page >

If you like this book, buy it!